package org.example.sys.bean;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ResponseData {
    private int code = ResponseMsg.SUCCESS.getCode();
    private String msg = ResponseMsg.SUCCESS.getMsg();

    public ResponseData() {
    }

    public ResponseData(ResponseMsg msg) {
        this.code = msg.getCode();
        this.msg = msg.getMsg();
    }

    public ResponseData(ResponseMsg responseMsg, Object data) {
        this.data = data;
    }

    public ResponseData(int rspCode) {
        this(rspCode, null);
    }

    public ResponseData(int rspCode, String rspMsg) {
        this.code = rspCode;
        this.msg = rspMsg;
    }

    public ResponseData(int rspCode, String rspMsg, Object data) {
        this(rspCode, rspMsg);
        this.data = data;
    }

    private Object data;

    public ResponseData setData(Object data) {
        this.data = data;
        return this;
    }
}
